package com.hmall.search.pojo;


import com.hmall.common.dto.Item;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ItemDto {

    private Long id;//商品id
    private String name;//商品名称
    private Long price;//价格（分）
    private String image;//商品图片
    private String category;//分类名称
    private String brand;//品牌名称
    private Integer sold;//销量
    private Integer commentCount;//评论数
    private Boolean isAD; //商品状态 1-正常,2下架

    //自动补全
    private List<String> suggestion = new ArrayList<>();

    public ItemDto(Item item){
        BeanUtils.copyProperties(item,this);

        suggestion.add(brand);
        suggestion.add(category);
    }


}
